package com.gedcorp.gedmanager;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * A dummy fragment representing a section of the app, but that simply
 * displays dummy text.
 */
public class GraphicsSectionFragmentBalance extends Fragment {

	public static final String ARG_SECTION_NUMBER = "section_number";

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_section_graphics_balance, container, false);
		if (!MainActivity.hasValidLicenseValue()) {
			rootView = inflater.inflate(R.layout.fragment_section_empty, container, false);
			return rootView;
		}
		// Demonstration of a collection-browsing activity.
		rootView.findViewById(R.id.daily_button_balance).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View view) {
				BalancePieChartActivity.PERIOD = BalancePieChartActivity.DAY;
				Intent intent = new Intent(getActivity(), BalancePieChartActivity.class);
				startActivity(intent);
			}
		});

		// Demonstration of a collection-browsing activity.
		rootView.findViewById(R.id.weekly_button_balance).setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						BalancePieChartActivity.PERIOD = BalancePieChartActivity.WEEK;
						Intent intent = new Intent(getActivity(),
								BalancePieChartActivity.class);
						startActivity(intent);
					}
				});

		// Demonstration of a collection-browsing activity.
		rootView.findViewById(R.id.monthly_button_balance).setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						BalancePieChartActivity.PERIOD = BalancePieChartActivity.MONTH;
						Intent intent = new Intent(getActivity(),
								BalancePieChartActivity.class);
						startActivity(intent);
					}
				});

		// Demonstration of a collection-browsing activity.
		rootView.findViewById(R.id.annual_button_balance).setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						BalancePieChartActivity.PERIOD = BalancePieChartActivity.YEAR;
						Intent intent = new Intent(getActivity(),
								BalancePieChartActivity.class);
						startActivity(intent);
					}
				});
		return rootView;
	}
}